#include "mainwidget.h"
#include "ui_mainwidget.h"

MainWidget::MainWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MainWidget)
{
    ui->setupUi(this);
    swiperWidget = NULL;
}

MainWidget::~MainWidget()
{
    delete ui;
}

void MainWidget::on_pushButton_clicked()
{
    if(swiperWidget == NULL)
    {
        swiperWidget = new SwiperWidget();
        connect(swiperWidget,&SwiperWidget::swiperWidgetCloseSign,
                this,&MainWidget::swiperWidgetCloseSlot);
        swiperWidget->show();
        this->hide();
    }
}

void MainWidget::swiperWidgetCloseSlot()
{
    if(swiperWidget != NULL)
    {
        swiperWidget->hide();
        delete swiperWidget;
        swiperWidget=NULL;
        this->show();
    }
}
